package collection;

import java.util.ArrayList;
import java.util.Collection;

public class NewForDemo {
    //for(元素类型)
    public static void main(String[] args) {
        Collection<String>c=new ArrayList<>();
        c.add("one");
        c.add("two");
        c.add("three");

        String []arr={"one","two","three","four","five"};
        for(int i=0;i<arr.length;i++)
            System.out.print(arr[i]+" ");
        System.out.println();
        for(String e:arr){//增强型for循环
            System.out.print(e+" ");
        }
        System.out.println();
        for(String e:c){
            System.out.print(e+" ");//不可以在迭代器里对集合进行增删
        }
    }
}
